package control.panel.prompt
{
	import control.panel.PanelControl;
	
	import events.SystemEvent;
	import global.GameType;
	
	import view.panel.prompt.ServerPromptPanel;

	public class ServerPromptPanelControl extends PanelControl
	{
		private var currentType:String;
		
		public function ServerPromptPanelControl()
		{
			initPanel();
			initListener();
		}
		
		private function initListener():void
		{
			_model.systeModel.addEventListener(SystemEvent.PROMPT,onPrompt);
		}
		
		private function onPrompt(event:SystemEvent):void
		{
			currentType = event.promptId;
			update(event.content);
		}
		
		private function initPanel():void
		{
			_view.serverPromptPanel = new ServerPromptPanel(this);
		}
		
		public function update(content:String):void
		{
			_view.serverPromptPanel.update(content);
			_view.serverPromptPanel.open();
		}
		
		public function onBut(type:int):void
		{
			_model.netRemote.sendPromptSelect(currentType,type);
		}
		
		public function clear():void
		{
			_view.serverPromptPanel.close();
		}
	}
}